<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>分销</title>
<script type="text/javascript" src="<%=basePath%>/js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="<%=basePath %>js/jquery.qrcode.min.js"></script>
<script type="text/javascript">
	$(function(){
		var userId="1";
		$.ajax({
	         type: "POST",
	         url:"<%=basePath%>user/getById?userId=" + userId,
			 dataType : 'JSON',
			 success : function(data) {
				 bindData(data);
			 }
		});
		function bindData(data){
			$("#userName").val(data.username);
			$("#amountLeft").val(data.amount_left);
		}
		
		$('#qrcode').qrcode("<%=basePath%>user/toregist?parentId="+userId);
		$("#invite").click(function(){
			window.location.href="<%=basePath%>user/toregist?parentId="+userId;
		});
	});
</script>
</head>
<body>
	<div>
		<table>
			<tr>
				<td>当前用户：</td>
				<td><input id="userName" disabled="true"/></td>
			</tr>
			<tr>
				<td>用户余额：</td>
				<td><input id="amountLeft" disabled="true"/></td>
			</tr>
			<tr>
			<tr>
			<td>
				<a href="javascript:void(0)" id="invite">邀请好友</a>
			</td>
			</tr>
			<tr>
			<td>
				<div id="qrcode"></div>
			</td>
			</tr>
		</table>
	</div>
</body>
</html>